{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "f8c0dc44",
   "metadata": {},
   "outputs": [],
   "source": [
    "#Note this Dominates for Comparision between Particle Classes\n",
    "def Dominates(x,y):\n",
    "    x= x.cost\n",
    "    y= y.cost\n",
    "    #dom = all(x<=y) and any(x<y)\n",
    "    flag = 1\n",
    "    dom = 0\n",
    "    for i in range(len(x)):\n",
    "        if(x[i]>y[i]):\n",
    "            flag = 0\n",
    "    \n",
    "    if(flag==1):\n",
    "        for i in range(len(x)):\n",
    "            if(x[i]<y[i]):\n",
    "                dom = 1\n",
    "                break\n",
    "    return dom "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "061f22df",
   "metadata": {},
   "outputs": [],
   "source": [
    "X=[1,2,3,6]\n",
    "Y = [1,2,3,5]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "cd938279",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "1"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "Dominates(Y,X)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "8066e1cd",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "Dominates(X,Y)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "f3506cfb",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.8"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
